/**
 * futures : masterlink.futures.vo.RiskManager.java
 */
package masterlink.futures.vo;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;

/**
 * TODO Write the description
 *
 * @author : tonyyang
 * Create date : 2011/11/10
 * @version 1.0.0	
 */
@Entity
public class GreeksRiskManagerGA implements Serializable{

	private static final long serialVersionUID = 7964718468633226046L;
	@EmbeddedId
	private PK id;
	@Column(name="qty")
	private Long qty;
	@Column(name="delta")
	private Double delta;
	@Column(name="gamma")
	private Double gamma;
	@Column(name="theta")
	private Double theta;
	@Column(name="vega")
	private Double vega;
	@Column(name="rho")
	private Double rho;
	@Column(name="balance")
	private Double balance;
	@Column(name="dealprice")
	private Double dealprice;
	
	/**
	 * @return the id
	 */
	public PK getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(PK id) {
		this.id = id;
	}

	/**
	 * @return the qty
	 */
	public Long getQty() {
		return qty;
	}

	/**
	 * @param qty the qty to set
	 */
	public void setQty(Long qty) {
		this.qty = qty;
	}

	/**
	 * @return the delta
	 */
	public Double getDelta() {
		return delta;
	}

	/**
	 * @param delta the delta to set
	 */
	public void setDelta(Double delta) {
		this.delta = delta;
	}

	/**
	 * @return the gamma
	 */
	public Double getGamma() {
		return gamma;
	}

	/**
	 * @param gamma the gamma to set
	 */
	public void setGamma(Double gamma) {
		this.gamma = gamma;
	}

	/**
	 * @return the theta
	 */
	public Double getTheta() {
		return theta;
	}

	/**
	 * @param theta the theta to set
	 */
	public void setTheta(Double theta) {
		this.theta = theta;
	}

	/**
	 * @return the vega
	 */
	public Double getVega() {
		return vega;
	}

	/**
	 * @param vega the vega to set
	 */
	public void setVega(Double vega) {
		this.vega = vega;
	}

	/**
	 * @return the rho
	 */
	public Double getRho() {
		return rho;
	}

	/**
	 * @param rho the rho to set
	 */
	public void setRho(Double rho) {
		this.rho = rho;
	}

	/**
	 * @return the balance
	 */
	public Double getBalance() {
		return balance;
	}

	/**
	 * @param balance the balance to set
	 */
	public void setBalance(Double balance) {
		this.balance = balance;
	}

	/**
	 * @return the dealprice
	 */
	public Double getDealprice() {
		return dealprice;
	}

	/**
	 * @param dealprice the dealprice to set
	 */
	public void setDealprice(Double dealprice) {
		this.dealprice = dealprice;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("GreeksRiskManagerGA [id=");
		builder.append(id);
		builder.append(", qty=");
		builder.append(qty);
		builder.append(", delta=");
		builder.append(delta);
		builder.append(", gamma=");
		builder.append(gamma);
		builder.append(", theta=");
		builder.append(theta);
		builder.append(", vega=");
		builder.append(vega);
		builder.append(", rho=");
		builder.append(rho);
		builder.append(", balance=");
		builder.append(balance);
		builder.append(", dealprice=");
		builder.append(dealprice);
		builder.append("]");
		return builder.toString();
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof GreeksRiskManagerGA))
			return false;
		GreeksRiskManagerGA other = (GreeksRiskManagerGA) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	/**
	 * @author tonyyang
	 *
	 */
	@Embeddable
	public static class PK implements Serializable{
		
		private static final long serialVersionUID = 5476023883739326876L;
		@Column(name="BROKER_ID")
		private String broker;
		@Column(name="acno")
		private String account;
		@Column(name="name")
		private String name;
		@Column(name="SETMONTH")
		private String setMonth;
		
		/**
		 * @return the broker
		 */
		public String getBroker() {
			return broker;
		}
		/**
		 * @param broker the broker to set
		 */
		public void setBroker(String broker) {
			this.broker = broker;
		}
		/**
		 * @return the account
		 */
		public String getAccount() {
			return account;
		}
		/**
		 * @param account the account to set
		 */
		public void setAccount(String account) {
			this.account = account;
		}
		/**
		 * @return the name
		 */
		public String getName() {
			return name;
		}
		/**
		 * @param name the name to set
		 */
		public void setName(String name) {
			this.name = name;
		}
		/**
		 * @return the setMonth
		 */
		public String getSetMonth() {
			return setMonth;
		}
		/**
		 * @param setMonth the setMonth to set
		 */
		public void setSetMonth(String setMonth) {
			this.setMonth = setMonth;
		}
		/* (non-Javadoc)
		 * @see java.lang.Object#toString()
		 */
		@Override
		public String toString() {
			StringBuilder builder = new StringBuilder();
			builder.append("GreeksRiskManagerPK [broker=");
			builder.append(broker);
			builder.append(", account=");
			builder.append(account);
			builder.append(", name=");
			builder.append(name);
			builder.append(", setMonth=");
			builder.append(setMonth);
			builder.append("]");
			return builder.toString();
		}
		/* (non-Javadoc)
		 * @see java.lang.Object#hashCode()
		 */
		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result
					+ ((account == null) ? 0 : account.hashCode());
			result = prime * result
					+ ((broker == null) ? 0 : broker.hashCode());
			result = prime * result + ((name == null) ? 0 : name.hashCode());
			result = prime * result
					+ ((setMonth == null) ? 0 : setMonth.hashCode());
			return result;
		}
		/* (non-Javadoc)
		 * @see java.lang.Object#equals(java.lang.Object)
		 */
		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			PK other = (PK) obj;
			if (account == null) {
				if (other.account != null)
					return false;
			} else if (!account.equals(other.account))
				return false;
			if (broker == null) {
				if (other.broker != null)
					return false;
			} else if (!broker.equals(other.broker))
				return false;
			if (name == null) {
				if (other.name != null)
					return false;
			} else if (!name.equals(other.name))
				return false;
			if (setMonth == null) {
				if (other.setMonth != null)
					return false;
			} else if (!setMonth.equals(other.setMonth))
				return false;
			return true;
		}
		
	}
}
